package top.jiangqiang.qyblog.portal.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.jiangqiang.qyblog.common.base.controller.BaseController;
import top.jiangqiang.qyblog.common.base.query.PageResult;
import top.jiangqiang.qyblog.common.base.response.Result;
import top.jiangqiang.qyblog.common.constant.RequestURLConstants;
import top.jiangqiang.qyblog.core.domain.vo.LinkVo;
import top.jiangqiang.qyblog.core.service.ILinkService;

/**
 * @author jiangqiang
 * @date 2022-11-27
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(RequestURLConstants.PUBLIC_LINK_CONTROLLER_PREFIX)
@Tag(name = "友情链接接口")
public class PublicLinkController extends BaseController {
    private final ILinkService linkService;

//    @PostMapping("/query")
//    @Operation(summary = "根据条件查询友情链接列表", description = "支持分页，排序等功能")
//    public Result<PageResult<LinkVo>> list(@RequestBody @Validated QueryCondition query) {
//        return Result.ok(linkService.findByCondition(query, LinkVo.class));
//    }

    @GetMapping("/{id}")
    @Operation(summary = "查询友情链接详情", description = "查询友情链接详情")
    public Result<LinkVo> get(@PathVariable Long id) {
        return linkService.getLink(id);
    }

}
